<template>
	<div>
		<el-tabs v-model="activeName" @tab-click="handleClick">
			<el-tab-pane label="未入库" name="first">
				<el-row :gutter="24">
					<el-col :span="24">
						<el-row :gutter="24">
							<!--<el-col :span="1" style="margin-right:0px;">
								<p class="queryLabel">入库类型:</p>
							</el-col>
							<el-col :span="4" style="margin-right: 0px;">
								<el-select size="small" v-model="carSelect.status" placeholder="请选择入库类型状态" clearable>
									<el-option v-for="item in saleType" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-col>
							<el-col :span="1" style="margin-right:0px;">
								<p class="queryLabel">仓库:</p>
							</el-col>
							<el-col :span="4" style="margin-right: 0px;">
								<el-select size="small" v-model="carSelect.warehouse" placeholder="请选择仓库" clearable>
									<el-option v-for="item in warehouseType" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-col>-->
							<el-col :span="1" style="">
								<p class="queryLabel">车系:</p>
							</el-col>
							<el-col :span="3">
								<el-input placeholder="请选择车系" size="small" icon="search" v-model="carModelCode" :on-icon-click="handleIconClick">
								</el-input>
							</el-col>
							<el-col :span="2" style="text-align: right;">
								<p class="queryLabel">车辆型号:</p>
							</el-col>
							<el-col :span="3">
								<el-select size="small" style="width: 100%;" v-model="carSelect.carModelCode" placeholder="请选择型号" clearable @change="changeModel">
									<el-option v-for="item in modelCombo" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-col>
							<el-col :span="1" style="">
								<p class="queryLabel">车辆配置:</p>
							</el-col>
							<el-col :span="3">
								<el-select size="small" style="width: 100%;" v-model="carSelect.carConfigureCode" placeholder="请选择配置" clearable>
									<el-option v-for="item in configCombo" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-col>
							<el-col :span="1" style="margin-right: 6px;">
								<p class="queryLabel">采购日期:</p>
							</el-col>
							<el-col :span="3">
								<el-date-picker v-model="data.firstStart" size="small" style="width:92%;" type="date" clearable placeholder="采购日期">
								</el-date-picker>
							</el-col>
							<el-col :span="1">
								<p class="queryLabel">至:</p>
							</el-col>
							<el-col :span="3">
								<el-date-picker v-model="data.firstStarts" size="small" style="width:92%;" type="date" clearable placeholder="采购日期">
								</el-date-picker>
							</el-col>
						</el-row>
						<el-row :gutter="24">
							<el-col :span="1" style="">
								<p class="queryLabel">提单号:</p>
							</el-col>
							<el-col :span="3">
								<el-input placeholder="请输入提单号" size="small" v-model="carSelect.orderNum">
								</el-input>
							</el-col>
							<el-col :span="2" style="text-align: right;">
								<p class="queryLabel">VIN:</p>
							</el-col>
							<el-col :span="3" style="text-align: left;margin-left: 5px;">
								<el-input placeholder="请输入VIN" size="small" style="width: 100%; " v-model="carSelect.vin">
								</el-input>
							</el-col>
							<!--<el-col :span="1" style="margin-left: -5px;">
								<p class="queryLabel">打印状态:</p>
							</el-col>
							<el-col :span="3" style="margin-left: 0px;">
								<el-select size="small" style="width: 100%; " v-model="carSelect.financeType" placeholder="车辆状态" >
									<el-option v-for="item in prientTypeCombo" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-col>-->
							<el-col :span="12" style="text-align: right;">
								<el-button type="primary" size="small" @click="query">查询</el-button>
								<el-button type="primary" size="small" @click="editPrice">维护暂估价</el-button>
								<el-button type="primary" size="small" @click="into">确认入库</el-button>
								<el-button type="primary" size="small" @click="intos" v-if="!lastInto">上月确认入库</el-button>
								<el-button type="primary" size="small" @click="clean">清空查询条件</el-button>
								<!--<el-button type="primary" size="small" @click="addInto">新增车辆</el-button>-->
							</el-col>
						</el-row>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-table :data="tableData.dataList" border @selection-change="handleSelectionChange">
							<el-table-column type="selection" width="55" label="选择">
							</el-table-column>
							<el-table-column prop="vin" label="VIN" width="180">
							</el-table-column>
							<el-table-column prop="validateStatus" label="打印状态" width="100" :formatter="validateStatusCov">
							</el-table-column>
							<el-table-column prop="estimatePrice" label="暂估价格" width="100">
							</el-table-column>
							<el-table-column prop="carSeries" label="车系名称" width="100">
							</el-table-column>
							<el-table-column prop="purchaseDate1" label="采购日期" width="120">
							</el-table-column>
							<el-table-column prop="purchaseNum" label="采购单号" width="100">
							</el-table-column>
							<el-table-column prop="carModelCode" label="车型代码" width="100">
							</el-table-column>
							<el-table-column prop="modelName" label="车型名称" width="150">
							</el-table-column>
							<el-table-column prop="configureCode" label="配置代码" width="120">
							</el-table-column>
							<el-table-column prop="configureName" label="配置名称" width="150">
							</el-table-column>
							<el-table-column prop="carModelYear" label="车型年" width="100">
							</el-table-column>
							<el-table-column prop="appearanceCode" label="外观代码" width="100">
							</el-table-column>
							<el-table-column prop="appearanceName" label="外观颜色" width="100">
							</el-table-column>
							<el-table-column prop="trimCode" label="内饰代码" width="100">
							</el-table-column>
							<el-table-column prop="trimName" label="内饰名称" width="100">
							</el-table-column>
							<el-table-column prop="chooseCode" label="加装代码" width="100">
							</el-table-column>
							<el-table-column prop="chooseName" label="加装名称" width="100">
							</el-table-column>
							<el-table-column prop="distributionDate" label="配货日期" width="120">
							</el-table-column>
							<el-table-column prop="sendDate" label="发货日期" width="120">
							</el-table-column>
							<el-table-column prop="oldNum" label="提单号" width="100">
							</el-table-column>
							<el-table-column prop="distributionStatus" label="配货状态" width="100">
							</el-table-column>
							<el-table-column prop="provideCompanyName" label="供货单位" width="100">
							</el-table-column>
						</el-table>
						<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
						</el-pagination>
					</el-col>
				</el-row>
			</el-tab-pane>
			<el-tab-pane label="已入库" name="second">
				<el-row :gutter="24">
					<el-col :span="24">
						<el-row :gutter="24">
							<el-col :span="1" style="margin-right:0px;">
								<p class="queryLabel">入库类型:</p>
							</el-col>
							<el-col :span="4" style="margin-right: 0px;">
								<el-select size="small" v-model="carSelect.status" placeholder="请选择入库类型状态" clearable>
									<el-option v-for="item in saleType" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-col>
							<el-col :span="1" style="margin-right:0px;">
								<p class="queryLabel">仓库:</p>
							</el-col>
							<el-col :span="4" style="margin-right: 0px;">
								<el-select size="small" v-model="carSelect.warehouse" placeholder="请选择仓库" clearable>
									<el-option v-for="item in warehouseType" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-col>
							<el-col :span="1" style="">
								<p class="queryLabel">车系:</p>
							</el-col>
							<el-col :span="3">
								<el-input placeholder="请选择车系" size="small" icon="search" v-model="carModelCode" :on-icon-click="handleIconClick">
								</el-input>
							</el-col>
							<el-col :span="2" style="text-align: right;">
								<p class="queryLabel">车辆型号:</p>
							</el-col>
							<el-col :span="3">
								<el-select size="small" style="width: 100%;" v-model="carSelect.carModelCode" placeholder="请选择配置" clearable @change="changeModel">
									<el-option v-for="item in modelCombo" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-col>
							<el-col :span="1" style="">
								<p class="queryLabel">车辆配置:</p>
							</el-col>
							<el-col :span="3">
								<el-select size="small" style="width: 100%;" v-model="carSelect.carConfigureCode" placeholder="请选择配置" clearable>
									<el-option v-for="item in configCombo" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-col>
						</el-row>
						<el-row>
							<el-col :span="1" style="margin-right: 6px;">
								<p class="queryLabel">入库日期:</p>
							</el-col>
							<el-col :span="4">
								<el-date-picker v-model="data.firstStart" size="small" style="width:92%;" type="date" clearable placeholder="日期">
								</el-date-picker>
							</el-col>
							<el-col :span="1">
								<p class="queryLabel">至:</p>
							</el-col>
							<el-col :span="4">
								<el-date-picker v-model="data.firstStarts" size="small" style="width:92%;" type="date" clearable placeholder="日期">
								</el-date-picker>
							</el-col>
							<el-col :span="1" style="text-align: left;">
								<p class="queryLabel">VIN:</p>
							</el-col>
							<el-col :span="3" style="text-align: left;margin-left: 5px;">
								<el-input placeholder="请输入VIN" size="small" style="width: 90%; " v-model="carSelect.vin">
								</el-input>
							</el-col>
							<el-col :span="7" style="text-align: right;">
								<el-button type="primary" size="small" @click="querys">查询</el-button>
								<el-button type="primary" size="small" @click="clean">清空查询条件</el-button>
								<el-button type="primary" size="small" @click="editPrices">修改暂估价</el-button>
								<el-button type="primary" size="small" @click="prientOrder">打印估入单</el-button>
							</el-col>
						</el-row>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-table :data="tableDatas.dataList" border @selection-change="handleSelectionChanges" :row-class-name="tableRowClassNames">
							<el-table-column type="selection" width="55" label="选择">
							</el-table-column>
							<el-table-column prop="vin" label="VIN" width="180">
							</el-table-column>
							<el-table-column prop="warehouse" label="所在仓库" width="120" :formatter="fromWarehouseCover">
							</el-table-column>
							<el-table-column prop="enterDate" label="入库日期" width="120">
							</el-table-column>
							<el-table-column prop="estimatePrice" label="暂估价格" width="100">
							</el-table-column>
							<el-table-column prop="carSeries" label="车系名称" width="100">
							</el-table-column>
							<el-table-column prop="purchaseDate1" label="采购日期" width="120">
							</el-table-column>
							<el-table-column prop="purchaseNum" label="采购单号" width="100">
							</el-table-column>
							<el-table-column prop="carModelCode" label="车型代码" width="100">
							</el-table-column>
							<el-table-column prop="modelName" label="车型名称" width="150">
							</el-table-column>
							<el-table-column prop="configureCode" label="配置代码" width="120">
							</el-table-column>
							<el-table-column prop="configureName" label="配置名称" width="150">
							</el-table-column>
							<el-table-column prop="carModelYear" label="车型年" width="100">
							</el-table-column>
							<el-table-column prop="appearanceCode" label="外观代码" width="100">
							</el-table-column>
							<el-table-column prop="appearanceName" label="外观颜色" width="100">
							</el-table-column>
							<el-table-column prop="trimCode" label="内饰代码" width="100">
							</el-table-column>
							<el-table-column prop="trimName" label="内饰名称" width="100">
							</el-table-column>
							<el-table-column prop="chooseCode" label="加装代码" width="100">
							</el-table-column>
							<el-table-column prop="chooseName" label="加装名称" width="100">
							</el-table-column>
							<el-table-column prop="distributionDate" label="配货日期" width="130">
							</el-table-column>
							<el-table-column prop="sendDate" label="发货日期" width="130">
							</el-table-column>
							<el-table-column prop="oldNum" label="提单号" width="100">
							</el-table-column>
							<el-table-column prop="distributionStatus" label="配货状态" width="100">
							</el-table-column>
							<el-table-column prop="provideCompanyName" label="供货单位" width="100">
							</el-table-column>
						</el-table>
						<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChanges" :current-page="CurentPages" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableDatas.total">
						</el-pagination>
					</el-col>
				</el-row>
			</el-tab-pane>
		</el-tabs>
		<carserice :show="showStart" v-if="showStart" v-on:close="showStart=false" v-on:insert="insert"></carserice>
		<!-- 弹出部门选择树-->
		<el-dialog title="选择公司" v-model="deptShow" size="small">
			<el-tree v-if="deptShow" :data="deptTreeData" ref="resTree" show-checkbox node-key="id" :highlight-current=true :props="defaultProps" accordion :default-checked-keys="checkedResKeys" :filter-node-method="filterNode"></el-tree>

			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="deptShow = false">关 闭</el-button>
				<el-button type="primary" @click="saveRes">提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog title="暂估价格" v-model="editFormShow" size="tiny">
			<el-form :model="comFormDataPrice" label-width="100px">
				<el-col :span="24">
					<el-form-item label="车辆金额：" prop="price">
						<el-input size="small" v-model="comFormDataPrice.price"></el-input>
					</el-form-item>
				</el-col>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="editFormShow = false">取 消</el-button>
				<el-button type="primary" v-on:click='saveEditPrice'>提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog title="暂估价格" v-model="editFormShows" size="tiny">
			<el-form :model="comFormDataPrices" label-width="100px">
				<el-col :span="24">
					<el-form-item label="车辆金额：" prop="price">
						<el-input size="small" v-model="comFormDataPrices.price"></el-input>
					</el-form-item>
				</el-col>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="editFormShows = false">取 消</el-button>
				<el-button type="primary" v-on:click='saveEditPrices'>提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog title="新增入库" v-model="addFormShow" size="small">
			<el-row>
				<el-card class="box-cards">
					<el-form :model="formData.addFormData" ref="addFormData" :rules="addRule" label-width="100px">
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="入库仓库" required prop="warehouseId">
								<el-select v-model="formData.addFormData.warehouseId" left size="small" placeholder="请选择仓库">
									<el-option v-for="item in warehouseId" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="11">
							<el-form-item label="入库日期" prop="enterDate" required>
								<el-date-picker size="small" style="width: 150px;" v-model="formData.addFormData.enterDate" format="yyyy-MM-dd" :editable=false type="date" placeholder="入库日期">
								</el-date-picker>
							</el-form-item>
						</el-col>
					</el-form>
				</el-card>
			</el-row>
			<div slot="footer" class="dialog-footer">
				<el-button @click="addFormShow = false">取 消</el-button>
				<el-button type="primary" v-on:click='saveCar'>提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog tittl="打印" v-model="dayinFormShow" id="dvData" size="large">
			<div id="printHtml">
				<div style=" width: 100%;" v-if="dayinFormShow" v-for="(list,index) in multipleSelectionss">
					<div style="height: 5px;"></div>
					<font face="宋体">
						<el-row>
							<div id="" style="margin-left: 35%; width: 65%;">
								<font face="宋体">
									<div style="border-collapse:collapse;font-size: 20px;margin:0 auto;color:#000000">
										润华集团股份有限公司暂估入库单
									</div>
								</font>
							</div>
							<div id="" style="margin-left: 0%; width: 100%; float: left;">
								&nbsp;
							</div>
							<div id="" style="margin-left: 15%; width: 20%; float: left;">
								{{prientDate[index].getStrat_printTime.substring(0,10)}}
							</div>
							<div id="" style="margin-left: 5%; width: 20%;float: left;">
								&nbsp;
							</div>
							<div id="" v-if="financeType" style="margin-left: 5%; width: 35%; float: left;">
								估入&nbsp;{{fromWarehouseCovs(list.warehouseId)}}{{prientDate[index].conncetionNo}}&nbsp;号
							</div>
							<div id="" v-if="!financeType" style="margin-left: 5%; width: 35%; float: left;">
								估入&nbsp;{{fromWarehouseCovs(warehouseID)}}{{prientDate[index].conncetionNo}}&nbsp;号
							</div>
							<div id="" style="margin-left: 0%; width: 100%; float: left;">
								&nbsp;
							</div>
							<div id="" v-if="financeType" style="margin-left: 5%; width: 30%; float: left;">
								收货仓库：&nbsp;{{fromWarehouseCov(list.warehouseId)}}
							</div>
							<div id="" v-if="!financeType" style="margin-left: 5%; width: 30%; float: left;">
								收货仓库：&nbsp;{{fromWarehouseCov(list.warehouseId)}}
							</div>
							<div id="" style="margin-left: 45%;float: left;">
								单位：&nbsp;元
							</div>
						</el-row>
						<!--车牌号信息 开始-->
						<el-row style="padding-left:5px; margin-top:5px">
							<el-col :span="24">
								<div>
									<table width="100%" border="1px solid #F9FAFC" cellspacing="0px" cellpadding="10px" bgcolor="#F9FAFC" style="border-collapse:collapse;font-size: 10px;margin:0 auto;color:#1F2D3D">
										<tr>
											<td width="40" colspan="2"><b>供货单位</b></td>
											<td v-if="financeType" width="150" colspan="3"><b>{{list.provideCompanyName}}</b></td>
											<td v-if="!financeType" width="150" colspan="3"><b>{{list.provideCompanyName}}</b></td>
											<td v-if="financeType" width="150" colspan="3"><b>存放地点：{{fromWarehouseCov(list.warehouseId)}}</b></td>
											<td v-if="!financeType" width="150" colspan="3"><b>存放地点：{{fromWarehouseCov(list.warehouseId)}}</b></td>
											<td width="40"><b>批号</b></td>
											<td width="70"><b></b></td>
										</tr>
										<tr>
											<td rowspan="2">发票</td>
											<td width="200" rowspan="2" colspan="2"></td>
											<td rowspan="2" colspan="2">到货日期</td>

											<td v-if="financeType" rowspan="2" colspan="2">{{list.enterDate}}</td>
											<td v-if="!financeType" rowspan="2" colspan="2">{{enterDates}}</td>
											<td rowspan="1" colspan="2">验收日期</td>
											<td v-if="financeType" rowspan="1">{{list.enterDate}}</td>
											<td v-if="!financeType" rowspan="1">{{enterDates}}</td>
										</tr>
										<tr>
											<td rowspan="1" colspan="2"></td>
											<td rowspan="1"></td>
										</tr>
										<tr>
											<td rowspan="1" colspan="3">产品名称及规格型号</td>
											<td rowspan="1" colspan="1">单位</td>
											<td rowspan="1">数量</td>
											<td rowspan="1">单价（元）</td>
											<td rowspan="1" colspan="2">金额（元）</td>
											<td rowspan="1" colspan="2">备注</td>
										</tr>
										<tr>
											<td rowspan="1" colspan="3">{{list.carSeries}}{{list.modelName}}{{list.configureName}}</td>
											<td rowspan="1" colspan="1">辆</td>
											<td rowspan="1">{{list.vin.length}}</td>
											<td rowspan="1">{{list.estimatePrice}}</td>
											<td rowspan="1" colspan="2">{{Number(list.estimatePrice)*list.vin.length}}</td>
											<td rowspan="2" colspan="2" height="94px">
												<a v-for="(lists,index) in list.vin"><span>{{lists}}<br/></span></a>
												 <!--LWVDA2030HB048255, LWVDA2036HB048406, LWVDA2036HB047319, LWVDA203XHB048182-->
											</td>
										</tr>
										<tr>
											<td rowspan="1" colspan="2">进货发票</td>
											<td rowspan="1" colspan="6"></td>
										</tr>
									</table>
								</div>
							</el-col>
						</el-row>
						<el-row>
							<div id="" style="margin-left: %; width: 100%; float: left;">
								&nbsp;
							</div>
							<div id="" style="margin-left: 7%; width: 20%; float: left;">
								制单：{{userName}}
							</div>
							<div id="" style="margin-left: 5%; width: 20%;float: left;">
								复核:
							</div>
							<div id="" style="margin-left: 0%; width: 15%;float: left;">
								验收员：
							</div>
							<div id="" style="margin-left: 5%; width: 15%;float: left;">
								仓库主管：
							</div>
							<el-row>
								<div>
									<div style="float: left;">
										<div>
											<!--<div style="width: 300px;">
												底盘号:&nbsp;{{list.vin}}
											</div>-->
										</div>
									</div>
								</div>
							</el-row>
						</el-row>
					</font>
					<div style="height: 120px;"></div>
				</div>
			</div>
			<!--底部的注意 结束-->
			<el-row style="margin-left:5px">
				<el-col>
					<el-button type="primary" @click="saveDayin">点击打印</el-button>
				</el-col>
			</el-row>
		</el-dialog>
		<!--添加车辆-->
		<el-dialog title="添加车辆" v-model="addCarInto" size="small">
			<el-row>
				<el-card class="box-cardaas">
					<el-form :model="ADDNoStoreFormData" ref="addNoStoreForm" :rules="addNoStoreRule" label-width="100px">
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="车系" required prop="carSeries">
								<el-input placeholder="请选择车系" size="small" icon="search" v-model="ADDLableName" :on-icon-click="handleIconClick">
								</el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="车辆型号" required prop="carModelId">
								<el-select size="small" style="width: 100%;" v-model="ADDNoStoreFormData.carModelId" placeholder="请选择配置" clearable @change="changeModels">
									<el-option v-for="item in ADDmodelCombo" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="车辆配置" required prop="configureId">
								<el-select size="small" style="width: 100%;" v-model="ADDNoStoreFormData.configureId" placeholder="请选择配置" clearable>
									<el-option v-for="item in ADDmodelCombo" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="车型年" required prop="carModelYear">
								<el-input size="small" v-model="ADDNoStoreFormData.carModelYear"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="外观" required prop="appearanceCode">
								<el-select size="small" style="width: 100%;" v-model="ADDNoStoreFormData.appearanceCode" placeholder="请选择外观" clearable>
									<el-option v-for="item in ADDappearanceCombos" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="内饰" required prop="trimCode">
								<el-select size="small" style="width: 100%;" v-model="ADDNoStoreFormData.trimCode" placeholder="请选择外观" clearable>
									<el-option v-for="item in ADDinteriorCombos" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="加装信息" required prop="chooseName">
								<el-input size="small" v-model="ADDNoStoreFormData.chooseName"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="VIN" required prop="vin">
								<el-input size="small" v-model="ADDNoStoreFormData.vin"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="发动机号" required prop="engineNum">
								<el-input size="small" v-model="ADDNoStoreFormData.engineNum"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:20px;">
							<el-form-item label="合格证号" required prop="certificateNum">
								<el-input size="small" v-model="ADDNoStoreFormData.certificateNum"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:15px;">
							<el-form-item label="暂估成本" prop="estimatePrice" required>
								<el-input size="small" v-model="ADDNoStoreFormData.estimatePrice"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:15px;">
							<el-form-item label="采购单号" prop="purchaseNum" required>
								<el-input size="small" v-model="ADDNoStoreFormData.purchaseNum"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:15px;">
							<el-form-item label="采购日期" prop="purchaseDate" required>
								<el-date-picker v-model="ADDNoStoreFormData.purchaseDate" size="small" style="width:100%;" type="date" clearable placeholder="配货日期">
								</el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:15px;">
							<el-form-item label="配货日期" prop="distributionDate" required>
								<el-date-picker v-model="ADDNoStoreFormData.distributionDate" size="small" style="width:100%;" type="date" clearable placeholder="配货日期">
								</el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:15px;">
							<el-form-item label="发货日期" prop="sendDate" required>
								<el-date-picker v-model="ADDNoStoreFormData.sendDate" size="small" style="width:100%;" type="date" clearable placeholder="配货日期">
								</el-date-picker>
							</el-form-item>
						</el-col>

						<el-col :span="11" style="margin-right:15px;">
							<el-form-item label="提单号" prop="oldNum" required>
								<el-input size="small" v-model="ADDNoStoreFormData.oldNum"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:15px;">
							<el-form-item label="配货状态" prop="distributionStatus" required>
								<el-input size="small" v-model="ADDNoStoreFormData.distributionStatus"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="11" style="margin-right:15px;">
							<el-form-item label="供货单位" prop="provideCompanyName" required>
								<el-input size="small" v-model="ADDNoStoreFormData.provideCompanyName"></el-input>
							</el-form-item>
						</el-col>
					</el-form>
				</el-card>
			</el-row>
			<div slot="footer" class="dialog-footer">
				<el-button @click="addCarInto = false">取 消</el-button>
				<el-button type="primary" @click="saveCarInto">提 交</el-button>
			</div>
		</el-dialog>

	</div>
</template>

<script>
	import moment from 'moment'
	import carserice from '../../insPlugins/carSeries.vue'
	export default {
		data: function() {
			return {
				//能否上月入库的标示
				lastInto:false,
				//直接打印还是二次打印
				financeType: false,
				//打印的仓库id
				warehouseID: "",
				//入库时间
				enterDates: "",
				//打印接口返回的数据
				prientDate: [],
				//打印状态的下拉
				prientTypeCombo: [{
					label: '未打印',
					value: '0'
				}, {
					label: '已打印',
					value: '1'
				}, ],
				//仓库下拉
				warehouseType: [],
				//车辆销售状态下拉
				saleType: [{
					label: '采购入库',
					value: '1'
				}, {
					label: '调拨入库',
					value: '3'
				}, {
					label: '销售退车入库',
					value: '2'
				}],
				//内饰的下拉
				ADDinteriorCombos: [],
				//外观的下拉
				ADDappearanceCombos: [],
				//名称
				ADDLableName: "",
				// 车型
				ADDmodelCombo: [],
				//配置
				ADDconfigCombo: [],
				//新增表单数据
				ADDNoStoreFormData: {
					ADDcarSeriesId: "", //车系
					carModelId: "", //车型
					configureId: "", //配置
					appearanceCode: "", //外观
					trimCode: "", //内饰
					carModelYear: "", //车型年
					chooseName: "", //加装信息
					vin: "",
					engineNum: "", //发动机号
					certificateNum: "", //合格证号
					estimatePrice: "", //暂估成本
					carSaleStatus: "",
					purchaseNum: "", //采购单号
					purchaseDate: "", //采购日期
					distributionDate: "", //配货日期
					sendDate: "", //发货日期
					oldNum: "", //提单号
					distributionStatus: "", //配货状态
					provideCompanyName: "", //货源
				},
				//初始化新增表单数据

				ADDaddNoStoreEmptyData: {
					ADDcarSeriesId: "", //车系
					carModelId: "", //车型
					configureId: "", //配置
					appearanceCode: "", //外观
					trimCode: "", //内饰
					carModelYear: "", //车型年
					chooseName: "", //加装信息
					vin: "",
					engineNum: "", //发动机号
					certificateNum: "", //合格证号
					estimatePrice: "", //暂估成本
					carSaleStatus: "",
					purchaseNum: "", //采购单号
					purchaseDate: "", //采购日期
					distributionDate: "", //配货日期
					sendDate: "", //发货日期
					oldNum: "", //提单号
					distributionStatus: "", //配货状态
					provideCompanyName: "", //货源
				},
				//冲估单的单号
				numberOrder: "",
				carSaleStatus: [],
				//新增表单数据
				addNoStoreFormData: {
					brand: "",
					carModel: "",
					colorName: "",
					modelName: "",
					trimName: "",
					configureName: "",
					configure: "",
					output: "",
					vin: "",
					estimatedCost: "",
					//financialBelong: "",
					carSaleStatus: "",
				},
				//仓库简称转换
				levelConvertDatas: {},
				//仓库名称转换
				levelConvertData: {},
				//初始化新增表单数据
				addNoStoreEmptyData: {
					brand: "",
					carModel: "",
					colorName: "",
					modelName: "",
					trimName: "",
					configureName: "",
					configure: "",
					output: "",
					vin: "",
					estimatedCost: "",
					//financialBelong: "",
					carSaleStatus: "",

				},
				addNoStoreFormShow: false,
				//新增车辆Dialog
				addCarInto: false,
				//新增车辆的显示
				addFormShow: false,
				//所有的组织机构树
				allTreeNode: [],

				//树型数据
				deptTreeData: [],
				//部门树
				defaultProps: {
					children: 'child',
					label: 'oName'
				},
				//默认选择中
				checkedResKeys: [],
				//显示单位
				deptShow: false,
				//tab默认显示
				activeName: 'first',
				//暂估金额显示框
				editFormShow: false,
				//暂估金额显示框
				editFormShows: false,
				//修改金额的form
				comFormDataPrice: {
					id: "",
					price: ""
				},
				//修改金额的form
				comFormDataPrices: {
					id: "",
					price: ""
				},
				//车系选择窗
				showStart: false,
				//查询条件-车型
				carModel: "",
				//日期
				data: {
					firstStart: "",
					firstStarts: ""
				},
				//页码数
				CurentPage: 1,
				CurentPages: 1,
				//每页的数量
				page: this.page,
				tableData: {
					total: 0,
					dataList: []
				},
				tableDatas: {
					total: 0,
					dataList: []
				},
				carStart: "",
				carStartComboData: [{
					value: '0',
					label: '采购在途'
				}, {
					value: '1',
					label: '在库'
				}, {
					value: '2',
					label: '已售'
				}, {
					value: '3',
					label: '调拨在途'
				}],
				userName: "",
				//选中的列
				multipleSelection: [],
				//选中的列，已入库
				multipleSelections: [],
				//选中的列，已入库打印取数
				multipleSelectionss: [],
				//查询条件
				carSelect: {
					//车辆状态 
					status: "",
					//初次入库起
					enterWarehouseDateStart: "",
					//初次入库止 
					enterWarehouseDateStop: "",
					//车系代码
					carSeriesCode: "",
					//车型代码 
					carModelCode: "",
					//配置代码
					carConfigureCode: "",
					//仓库
					warehouse: "",
					//vin
					vin: "",
					/*打印状态修改了*/
					//财务状态
					financeType: "1",

					//提单号
					orderNum: "",
				},
				//查询条件初始值
				carSelectS: {
					//车辆状态 
					status: "",
					//初次入库起
					enterWarehouseDateStart: "",
					//初次入库止 
					enterWarehouseDateStop: "",
					//车系代码
					carSeriesCode: "",
					//车型代码 
					carModelCode: "",
					//配置代码
					carConfigureCode: "",
					//仓库
					warehouse: "",
					//vin
					vin: "",
					/*打印状态修改了*/
					//财务状态
					financeType: "1",
					//提单号
					orderNum: "",
				},
				loadingVue: null,
				//车型名称
				carModelCode: "",
				//配置的下拉
				configCombo: [],
				//车型的下拉
				modelCombo: [],
				//查询的类型（在库状态）
				queryStatus: "1",
				addNoStoreRule: {},
				addRule: {},
				warehouseId: [],
				formData: {
					addFormData: {
						vin: "",
						warehouseId: "",
						enterDate: new Date(),
						carModel: "",
					},
					multipleSelectionCar: [],
				},
				formEmptyData: {
					addFormData: {
						vin: "",
						warehouseId: "",
						enterDate: new Date(),
						carModel: "",
					},
					multipleSelectionCar: [],
				},
				//打印窗口
				dayinFormShow: false,
			}
		},
		methods: {
			//打印
			saveDayin: function() {
				debugger;
				/*调用打印接口*/
				//用 JavaScript 实现页面数据的打印 ： 主要是用到了一个 print() 函数 ， 该函数将会打印整个 web 页面 body 内的所有 html 数据 ! 使用方法为 window.print(); 打印页面上局部的数据，则可以 用
				//把数据嵌套在 一个 div 里，获得 div				
				var newstr = document.getElementById("printHtml").innerHTML;
				var printWindow = window.open();
				printWindow.document.body.innerHTML = newstr;
				printWindow.print();
				printWindow.close();
				this.$data.dayinFormShow = false;
				this.query();
				//调用回传打印状态（不用了后台处理）
				//this.savePrient();//后台处理
			},
			//回传给后台已经打印
			savePrient: function() {
				var idList = [];
				for(var i = 0; i < this.$data.prientDate.length; i++) {
					idList.push(this.$data.prientDate[i].id);
				}
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/updateGetInvoicePrice', idList, {
					params: {}
				}).then((response) => {
					debugger;
					if(response.data.success) {
						debugger;
						this.$message("记录打印状态成功");
					} else {
						this.$message.error(response.data.msg);
					}
				}, (response) => {});
			},
			//点击打印后打印估入单
			prientOrder: function() {
				debugger;
				var fromDatePrientList = [];
				var fromDatePrient = {};
				//循环遍历选择的车辆
				for(var i = 0; i < this.$data.multipleSelections.length; i++) {
					//现将vin改为数组
					var vinList = [];
					vinList[0] = this.$data.multipleSelections[i].vin;
					this.$data.multipleSelections[i].vin = vinList;
				}
				this.$data.multipleSelectionss = this.$data.multipleSelections.slice(0);
				debugger;
				for(var i = 0; i < this.$data.multipleSelections.length; i++) {
					fromDatePrient.carId = this.$data.multipleSelections[i].id;
					fromDatePrient.invoicesType = "1";
					fromDatePrient.invoicesPrice = this.$data.multipleSelections[i].estimatePrice;
					fromDatePrientList.push(fromDatePrient);
				}
				//获取流水号和入库时间
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/selectByInvoicePrice', fromDatePrientList).then(resp => {
					debugger;
					this.$data.prientDate = resp.data;
					this.$data.financeType = true;
					this.$data.dayinFormShow = true;
				}, resp => {});
			},
			//更新流水单号
			saveNumber: function(val) {
				this.$http.get(this.API_ROOT + '/scm/common/updateSerialNumber', {
					params: {
						currentSerial: val
					}
				}).then((response) => {
					debugger;
					//this.$data.numberOrder = response.data.serialNu;
				}, (response) => {});
			},
			validateStatusCov: function(row, column) {
				var temp = '';
				switch(row.financeType) {
					case '1':
						temp = "已打印";
						break;
					case '0':
						temp = '未打印';
						break;
					default:
						''
						break
				};
				return temp;
			},
			//确认入库-按当前时间入库
			into: function() {
				var flogPrice = true;
				var flogCerice = true;
				if(this.$data.multipleSelection.length >= 1) {
					//循环判断有无暂估价格和车型车系，如果没有则更改指定标识变量
					for(var i = 0; i < this.$data.multipleSelection.length; i++) {
						//判断暂估价
						if(this.$data.multipleSelection[i].estimatePrice == "" || this.$data.multipleSelection[i].estimatePrice == "0"|| this.$data.multipleSelection[i].estimatePrice == null) {
							flogPrice = false;
							break;
						}
						//判断车型车系
						if(this.$data.multipleSelection[i].carSeries == "" || this.$data.multipleSelection[i].carSeries == null || this.$data.multipleSelection[i].modelName == "" || this.$data.multipleSelection[i].modelName == null) {
							flogCerice = false;
							break;
						}
					};
					//判断暂估价格和车辆车系的价格
					if(flogPrice == true && flogCerice == true) {
						//this.$data.formData.addFormData = Object.assign(this.$data.formData.addFormData, this.$data.formEmptyData.addFormData)
						//直接打印暂估单
						this.enterWarehousePrient();
					} else if(flogPrice == false) {
						this.$message.error("请维护暂估价格！");
					} else {
						this.$message.error("请维护车型车系并刷新车型！");
					}
				} else {
					this.$message.error("请选择一辆车！");
				}
			},
			//确认入库-按上月最后一天入库
			intos: function() {
				var flogPrice = true;
				var flogCerice = true;
				if(this.$data.multipleSelection.length >= 1) {
					//循环判断有无暂估价格和车型车系，如果没有则更改指定标识变量
					for(var i = 0; i < this.$data.multipleSelection.length; i++) {
						//判断暂估价
						if(this.$data.multipleSelection[i].estimatePrice == "" || this.$data.multipleSelection[i].estimatePrice == "0"|| this.$data.multipleSelection[i].estimatePrice == null) {
							flogPrice = false;
							break;
						}
						//判断车型车系
						if(this.$data.multipleSelection[i].carSeries == "" || this.$data.multipleSelection[i].carSeries == null || this.$data.multipleSelection[i].modelName == "" || this.$data.multipleSelection[i].modelName == null) {
							flogCerice = false;
							break;
						}
					};
					//判断暂估价格和车辆车系的价格
					if(flogPrice == true && flogCerice == true) {
						//this.$data.formData.addFormData = Object.assign(this.$data.formData.addFormData, this.$data.formEmptyData.addFormData)
						//直接打印暂估单
						this.enterWarehousePrients();
					} else if(flogPrice == false) {
						this.$message.error("请维护暂估价格！");
					} else {
						this.$message.error("请维护车型车系并刷新车型！");
					}
				} else {
					this.$message.error("请选择一辆车！");
				}
			},
			//保存已选择的车辆、仓库ID和入库时间
			saveCar: function() {
				debugger;
				this.$data.formData.multipleSelectionCar = this.$data.multipleSelection;
				this.$data.formData.addFormData.enterDate = this.moment(this.$data.formData.addFormData.enterDate).format("YYYY-MM-DD");
				this.$http.post(this.API_ROOT + '/scm/stock/save', this.$data.formData, {
					params: {
						type: '0',
					}
				}).then(resp => {
					if(resp.data.success) {
						debugger;
						this.$data.addFormShow = false;
						//保存仓库id
						this.$data.financeType = false;
						this.$data.warehouseID = this.$data.formData.addFormData.warehouseId;
						this.$data.enterDates = this.moment(this.$data.formData.addFormData.enterDate).format("YYYY-MM-DD");
						//调用打印
						this.enterWarehousePrient();
					} else {
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			//确认入库后打印估入单--当前日期
			enterWarehousePrient: function() {
				//声明打印的暂存变量
				var carList = [];
				//循环遍历选择的车辆
				for(var i = 0; i < this.$data.multipleSelection.length; i++) {
					//现将vin改为数组
					var vinList = [];
					vinList[0] = this.$data.multipleSelection[i].vin;
					this.$data.multipleSelection[i].vin = vinList;
					//现将车辆ID改为数组
					var IDList = [];
					IDList[0] = this.$data.multipleSelection[i].id;
					this.$data.multipleSelection[i].id = IDList;
					//设置是否同一车型，同一价格的车辆的标识
					var repeatFlog = true;
					//嵌套循环判断是否一致
					for(var j = 0; j < carList.length; j++) {
						if(carList[j].configureId == this.$data.multipleSelection[i].configureId && carList[j].estimatePrice == this.$data.multipleSelection[i].estimatePrice) {
							repeatFlog = false;
							carList[j].vin.push(this.$data.multipleSelection[i].vin[0]);
							carList[j].id.push(this.$data.multipleSelection[i].id[0]);
							break;
						}
					}
					if(repeatFlog == true) {
						carList.push(this.$data.multipleSelection[i]);
					}
				}
				for(var i = 0; i < carList.length; i++) {
					var result = [];
					if(carList[i].vin.lenght > 5) {
						for(var j = 5, len = carList[i].lenght.length; i < len; j += 5) {
							var vinSL = carList[i].vin.slice(j, j + 5)
							var carArr = carList[i];
							carArr.vin = vinSL;
							carList.push(carArr)
							// result.push(carList.slice(i,i+4));
						}
						carList[i].vin = carList[i].vin.slice(0, 5)
					}
				}
				debugger;
				var fromDatePrientList = [];
				for(var i = 0; i < carList.length; i++) {
					var fromDatePrient = {};
					fromDatePrient.carId = carList[i].id;
					fromDatePrient.invoicesType = "1";
					//fromDatePrient.flag = false;
					fromDatePrient.invoicesPrice = carList[i].estimatePrice;
					fromDatePrientList.push(fromDatePrient);
				}
				this.$data.multipleSelectionss = carList.slice(0);
			
				//获取流水号和入库时间
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/batchByInvoicePrice', fromDatePrientList).then(resp => {
					debugger;
					this.$data.prientDate = resp.data;
					this.$data.dayinFormShow = true;
				}, resp => {});
			},
			//确认入库后打印估入单--上月最后一天
			enterWarehousePrients: function() {
				//声明打印的暂存变量
				var carList = [];
				//循环遍历选择的车辆
				for(var i = 0; i < this.$data.multipleSelection.length; i++) {
					//现将vin改为数组
					var vinList = [];
					vinList[0] = this.$data.multipleSelection[i].vin;
					this.$data.multipleSelection[i].vin = vinList;
					//现将车辆ID改为数组
					var IDList = [];
					IDList[0] = this.$data.multipleSelection[i].id;
					this.$data.multipleSelection[i].id = IDList;
					//设置是否同一车型，同一价格的车辆的标识
					var repeatFlog = true;
					//嵌套循环判断是否一致
					for(var j = 0; j < carList.length; j++) {
						if(carList[j].configureId == this.$data.multipleSelection[i].configureId && carList[j].estimatePrice == this.$data.multipleSelection[i].estimatePrice) {
							repeatFlog = false;
							carList[j].vin.push(this.$data.multipleSelection[i].vin[0]);
							carList[j].id.push(this.$data.multipleSelection[i].id[0]);
							break;
						}
					}
					if(repeatFlog == true) {
						carList.push(this.$data.multipleSelection[i]);
					}
				}
				for(var i = 0; i < carList.length; i++) {
					var result = [];
					if(carList[i].vin.lenght > 5) {
						for(var j = 5, len = carList[i].lenght.length; i < len; j += 5) {
							var vinSL = carList[i].vin.slice(j, j + 5)
							var carArr = carList[i];
							carArr.vin = vinSL;
							carList.push(carArr)
							// result.push(carList.slice(i,i+4));
						}
						carList[i].vin = carList[i].vin.slice(0, 5)
					}
				}
				debugger;
				var fromDatePrientList = [];
				for(var i = 0; i < carList.length; i++) {
					var fromDatePrient = {};
					fromDatePrient.carId = carList[i].id;
					fromDatePrient.invoicesType = "1";
					fromDatePrient.flag = false;
					fromDatePrient.invoicesPrice = carList[i].estimatePrice;
					fromDatePrientList.push(fromDatePrient);
				}
				this.$data.multipleSelectionss = carList.slice(0);
				//获取流水号和入库时间
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/batchByInvoicePrice', fromDatePrientList).then(resp => {
					debugger;
					this.$data.prientDate = resp.data;
					this.$data.dayinFormShow = true;
				}, resp => {});
			},
			//保存查询树
			saveRes: function() {
				this.$data.carSelect.companyId = this.$refs.resTree.getCheckedKeys();
				debugger;
				this.$data.deptShow = false;
			},
			filterNode: function(value, data, node) {
				if(!value) return true;
				return data.resName.indexOf(value) !== -1;
			},
			//打开部门
			openDeptTree: function(e) {
				this.$data.deptShow = true;
			},
			handleClick(tab, event) {
				//先清空查询条件
				this.clean();
				debugger;
				if(tab.name == "first") {
					this.query();
					this.$data.CurentPage = 1;
				} else {
					this.querys();
					this.$data.CurentPages = 1;
				}
			},
			// 暂估入库/新增车辆监听 // 新增车辆按钮
			addInto: function() {
				//alert("入库/新增车辆");
				this.$data.ADDLableName = "";
				this.clean();
				this.$data.addCarInto = true;
				debugger;
			},
			saveCarInto: function() {
				//alert("保存");
				debugger;
				this.$refs.addNoStoreForm.validate(function(valid) {
					if(valid) {
						this.$data.ADDNoStoreFormData.purchaseDate = this.momentFu(this.$data.ADDNoStoreFormData.purchaseDate);
						this.$data.ADDNoStoreFormData.distributionDate = this.momentFu(this.$data.ADDNoStoreFormData.distributionDate);
						this.$data.ADDNoStoreFormData.sendDate = this.momentFu(this.$data.ADDNoStoreFormData.sendDate);
						this.$http.post(this.API_ROOT + '/scm/car/save', this.$data.ADDNoStoreFormData)
							.then(resp => {
								if(resp.data.success) {
									this.$message(resp.data.msg);
									this.$data.addCarInto = false;
								} else {
									this.$message.error(resp.data.msg);
								}
							}, resp => {});
					}
					return false;
				}.bind(this));
			},
			//清空查询条件
			clean: function() {
				this.$data.carSelect = Object.assign(this.$data.carSelect, this.$data.carSelectS);
				this.$data.ADDNoStoreFormData = Object.assign(this.$data.ADDNoStoreFormData, this.$data.ADDaddNoStoreEmptyData)
				this.$data.carModelCode = "";
				debugger;
			},
			del: function() {
				if(this.$data.multipleSelection.length < 1) {
					this.$message.error("请选择车辆");
				} else {
					this.$confirm('确认要删除这些数据吗?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						var data = [];
						for(var i = 0; i < this.$data.multipleSelection.length; i++) {
							data[i] = this.$data.multipleSelection[i].vin
						}
						this.$http.post(this.API_ROOT + '/scm/car/delUserlessCar', data, {
							params: {}
						}).then((response) => {
							this.$message(response.data.msg);
							this.query();
						}, (response) => {});
					}).catch(() => {
						this.$message({
							type: 'info',
							message: '已取消此操作'
						});
					});
				}
			},
			//车型改变的回调
			changeModel: function(val) {
				if(val != "") {
					this.comboConfigure(val);
				}
				debugger;
			},
			//选择车型后的回调
			comboConfigure: function(val) {
				this.$http.get(this.API_ROOT + '/base/carConfigure/combo', {
					params: {
						modelId: val
					}
				}).then((response) => {
					debugger;
					this.$data.configCombo = response.data;
					this.$data.carSelect.carConfigureCode = "";
					//this.$message(response.data);
				}, (response) => {});
			},
			//刷新车型
			refreshC: function() {
				this.$data.loadingVue = this.$loading({
					fullscreen: false,
					text: "正在刷新数据，请稍候"
				});
				this.$http.post(this.API_ROOT + '/scm/car/flashModelId', {
					params: {}
				}).then((response) => {
					debugger;
					this.$data.loadingVue.close();
					this.$message(response.data.msg);
					this.query();
				}, (response) => {});
			},
			//刷新配置
			refreshF: function() {
				//等待动画
				this.$data.loadingVue = this.$loading({
					fullscreen: false,
					text: "正在刷新数据，请稍候"
				});
				this.$http.post(this.API_ROOT + '/scm/car/flashConfigId', {
					params: {}
				}).then((response) => {
					debugger;
					this.$data.loadingVue.close();
					this.$message("保存成功");
					this.query();
				}, (response) => {});
			},
			//根据内容改变表格颜色（无车型红色，无配置蓝色）
			tableRowClassNames(row, index) {
				//debugger;
				if(row.financeType == "3") {
					return 'haveInvoice-row';
				} else {
					return "";
				}
			},
			//保存金额
			saveEditPrice: function() {
				debugger;
				this.$http.get(this.API_ROOT + '/scm/car/updateEstimate', {
					params: {
						id: this.$data.comFormDataPrice.id,
						price: this.$data.comFormDataPrice.price
					}
				}).then((response) => {
					debugger;
					this.$message("保存成功");
					this.query();
				}, (response) => {});
				this.$data.editFormShow = false;
			},
			//保存金额
			saveEditPrices: function() {
				debugger;
				this.$http.get(this.API_ROOT + '/src/carInvoicePrice/updateEstimatePrice', {
					params: {
						id: this.$data.comFormDataPrices.id,
						price: this.$data.comFormDataPrices.price
					}
				}).then((resp) => {
					if(resp.data.success) {
						debugger;
						this.$message("保存成功");
						this.querys();
					} else {
						this.$message.error(resp.data.msg);
					}
				}, (resp) => {});
				this.$data.editFormShows = false;
			},
			//维护暂估价
			editPrice: function(index) {
				debugger;
				if(this.$data.multipleSelection.length == 1) {
					this.$data.comFormDataPrice.id = this.$data.multipleSelection[0].id;
					this.$data.comFormDataPrice.price = this.$data.multipleSelection[0].estimatePrice;
					//this.$data.comFormDataPrice.price=
					this.$data.editFormShow = true;
				} else {
					this.$message.error("请选择一辆车！");
				}
			},
			//维护暂估价
			editPrices: function(index) {
				debugger;
				if(this.$data.multipleSelections.length == 1) {
					this.$data.comFormDataPrices.id = this.$data.multipleSelections[0].id;
					this.$data.comFormDataPrices.price = this.$data.multipleSelections[0].estimatePrice;
					//this.$data.comFormDataPrice.price=
					this.$data.editFormShows = true;
				} else {
					this.$message.error("请选择一辆车！");
				}
			},
			//车系选择的回调
			insert: function(val, lable) {
				debugger;
				this.$data.carSelect.carSeriesCode = val;
				this.$data.carModelCode = lable;
				this.$data.ADDLableName = lable;
				this.$data.ADDNoStoreFormData.ADDcarSeriesId = val; /*data*/
				this.getAppearanceCombo(val);
				this.getInteriorCombo(val);
				this.$http.get(this.API_ROOT + '/base/carModel/combo', {
					params: {
						seriesId: val
					}
				}).then((response) => {
					debugger;
					this.$data.modelCombo = response.data;
					this.$data.ADDmodelCombo = response.data; /*data*/
					this.$data.carSelect.carModelCode = "";
					this.$data.carSelect.carConfigureCode = "";
					//this.$message(response.data);
				}, (response) => {});

			},
			//车型改变的回调
			changeModels: function(val) {
				if(val != "") {
					this.comboConfigures(val);
				}
				debugger;
			},
			//查询外观
			getAppearanceCombo: function(val) {
				this.$http.get(this.API_ROOT + '/scm/appearance/combo', {
					params: {
						carSeriesId: val
					}
				}).then((response) => {
					debugger;
					this.$data.ADDappearanceCombos = response.data;
					//this.$message(response.data);
				}, (response) => {});
			},
			//查询内饰
			getInteriorCombo: function(val) {
				this.$http.get(this.API_ROOT + '/scm/interior/combo', {
					params: {
						seriesId: val
					}
				}).then((response) => {
					debugger;
					this.$data.ADDinteriorCombos = response.data;
					//this.$message(response.data);
				}, (response) => {});
			},
			//选择车型后的回调
			comboConfigures: function(val) {
				this.$http.get(this.API_ROOT + '/base/carConfigure/combo', {
					params: {
						modelId: val
					}
				}).then((response) => {
					debugger;
					this.$data.ADDconfigCombo = response.data;
					//this.$data.configCombo = response.data;
					//this.$data.carSelect.carConfigureCode = "";
					//this.$message(response.data);
					debugger;
				}, (response) => {});
			},
			//打开车型车系选择
			handleIconClick: function() {
				this.$data.showStart = true;
			},
			//复选框回调函数
			handleSelectionChange: function(val) {
				debugger;
				this.$data.multipleSelection = val;
			},
			//复选框回调函数
			handleSelectionChanges: function(val) {
				debugger;
				this.$data.multipleSelections = val;
			},
			//列表，分页大小切换
			handleSizeChange: function() {},
			//列表,当前页切换
			handleCurrentChange: function(currentPage) {
				debugger;
				this.$data.CurentPage = currentPage;
				this.query();
			},
			//列表,当前页切换
			handleCurrentChanges: function(currentPage) {
				debugger;
				this.$data.CurentPages = currentPage;
				this.querys();
			},
			//查询
			query: function() {
				debugger;
				this.$data.carSelect.purchaseStartDate = this.momentFu(this.$data.data.firstStart);
				this.$data.carSelect.purchaseStopDate = this.momentFu(this.$data.data.firstStarts);
				this.$http.post(this.API_ROOT + '/scm/car/newPage', this.$data.carSelect, {
					params: {
						root: window.localStorage.getItem("companyId"),
						status: this.$data.queryStatus,
						start: this.$data.CurentPage,
						limit: this.$data.page.pageSize
					}
				}).then(resp => {
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						this.$data.tableData = resp.data;
					} else {
						this.$message.error(resp.data.msg);
					}
				}, resp => {})
			},
			//查询
			querys: function() {
				debugger;
				this.$data.carSelect.enterWarehouseDateBegin = this.momentFu(this.$data.data.firstStart);
				this.$data.carSelect.enterWarehouseDateEnd = this.momentFu(this.$data.data.firstStarts);
				this.$http.post(this.API_ROOT + '/scm/stock/newPage', this.$data.carSelect, {
					params: {
						root: window.localStorage.getItem("companyId"),
						status: "1",
						type: "1",
						start: this.$data.CurentPages,
						limit: this.$data.page.pageSize
					}
				}).then(resp => {
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						this.$data.tableDatas = resp.data;
					} else {
						this.$message.error(resp.data.msg);
					}
				}, resp => {})
			},
			//时间判断为空的封装
			momentFu: function(dt) {
				if(dt == '' || dt == null || dt == undefined) {
					return "";
				} else {
					return this.moment(dt).format("YYYY-MM-DD");
				}
			},
			//发出仓库代码与名称转换
			fromWarehouseCov: function(row) {
				debugger;
				return this.$data.levelConvertData[row];
			},
			//发出仓库代码与名称转换
			fromWarehouseCover: function(row, column) {
				return this.$data.levelConvertData[row.warehouseId];
			},
			//发出仓库代码与名称转换
			fromWarehouseCovs: function(row, column) {
				return this.$data.levelConvertDatas[row];
			},
			//状态转换
			statusCov: function(row, column) {
				switch(row.status) {
					case "0":
						return "采购在途";
						break;
					case "1":
						return "在库";
						break;
					case "2":
						return "已售";
						break;
					case "3":
						return "调拨在途";
						break;
					default:
						return "调拨在途";
				}
			},
			//获取组织机构树的所有节点
			getTreeNode: function(treeAll) {
				debugger;
				for(var i = 0; i < treeAll.length; i++) {
					this.$data.allTreeNode.push(treeAll[i].id);
					if(treeAll[i].child.lenth == 0) {
						return;
					} else {
						this.getTreeNode(treeAll[i].child);
					}
				}
			}
		},
		components: {
			carserice
		},
		created: function() {
			this.$data.userName = window.localStorage.getItem("userName");
			this.query();
			//获取部门资源树
			this.$http.get(this.API_ROOT + '/rbac/dept/tree', {
				params: {
					root: window.localStorage.getItem("companyId"),
					type: "1",
				}
			}).then((response) => {
				this.$data.deptTreeData = response.data.dataList;
				this.$data.allTreeNode = [];
				this.getTreeNode(this.$data.deptTreeData);
			}, (response) => {});
			//车辆销售状态
			this.$http.get(this.API_ROOT + '/base/dict/combo', {
				params: {
					group: "scmWarehouseCarSaleStatus"
				}
			}).then((response) => {
				this.$data.carSaleStatus = response.data;
			}, (response) => {});
			//获取仓库类型下拉
			this.$http.get(this.API_ROOT + '/scm/warehouse/combo', {
				params: {
					group: "warehouse"
				}
			}).then((response) => {
				this.$data.warehouseType = response.data;
			}, (response) => {});
			//仓库下拉
			this.$http.get(this.API_ROOT + '/scm/warehouse/combo', {
				params: {}
			}).then((response) => {
				this.$data.warehouseId = response.data;
			}, (response) => {});
			this.$http.get(this.API_ROOT + '/scm/warehouse/convert', {
				params: {}
			}).then((response) => {
				this.$data.levelConvertData = response.data;
			}, (response) => {});
			this.$http.get(this.API_ROOT + '/scm/warehouse/convertCode', {
				params: {}
			}).then((response) => {
				this.$data.levelConvertDatas = response.data;
			}, (response) => {});
			//获取能否上月入库的接口
			this.$http.get(this.API_ROOT + '/scm/monthlyBalance/ifMonthEnd').then((response) => {
				if(response.data.success) {
					this.$data.lastInto = response.data.data.success;
					} else {
						this.$message.error(resp.data.msg);
					}
			}, (response) => {});

		}
	}
</script>

<style>
	.el-table .haveInvoice-row {
		background: #99CCFF
	}
	
	.el-table .noPri-row {
		background: #20A0FF;
	}
	
	.el-table .noSer-row {
		background: #FF4949
	}
	
	.box-cardaa {
		width: 100%;
		height: 400px;
		margin-top: 20px;
		margin-bottom: 20px;
	}
	
	.box-cardaas {
		width: 100%;
		height: 550px;
		margin-top: 20px;
		margin-bottom: 20px;
	}
	
	.box-cards {
		width: 100%;
		height: 80px;
		margin-top: 20px;
		margin-bottom: 20px;
	}
</style>